<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	$id=intval($_RQ['id']);
	$item=pdo_get('jy_weishop_live_room',array('id'=>$id));
	$item['nestable']=json_decode($item['nestable'],true);
	$item['menu']=json_decode($item['menu'],true);
	if (empty($item['nestable'])) {
		$item['nestable'] = array('interaction', 'goods', 'introduce');
	}
	if (empty($item['menu'])) {
		$item['menu'] = array(
			'interaction'=>array('name'=>'直播间'),
			'goods'=>array('name'=>'商城'),
			'introduce'=>array('name'=>'介绍'),
			'customname1'=>array('name'=>'自定义'),
			'customname2'=>array('name'=>'自定义'),
			'customname3'=>array('name'=>'自定义'),
			'customname4'=>array('name'=>'自定义'),
		);	
	}
	$return['item']=$item;
	$return['menus']=array('interaction', 'goods', 'introduce', 'customname1', 'customname2', 'customname3', 'customname4');
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	//print_r($post);exit;
	$data=array(
		'menu'=>ijson_encode($post['menu']),
		'nestable'=>ijson_encode($post['nestable']),
		'content'=>$post['content'],
	);
	pdo_update('jy_weishop_live_room',$data,array('id'=>$post['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('操作成功！','','room/');
}
/*******basic*******/
/*******op*******/
